package com.pine.dcts.auth.config;


import com.pine.dcts.auth.verfivation.RedisVerificationCodeCache;
import com.pine.dcts.auth.verfivation.VerificationCodeCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

/** 验证码缓存配置类
 * @author xiaoyuan
 * @create 2020/7/1 15:03
 **/
@Configuration
public class VerificationCodeConfig {

    //默认位五分钟
    @Value("${dcts.vcc.expire:600000}")
    private Long codeExpire;
    @Autowired
    private StringRedisTemplate redisTemplate;

    @Bean
    public VerificationCodeCache verificationCodeCache(){
        return new RedisVerificationCodeCache(redisTemplate,codeExpire);
    }
}
